const afterSales = {
  namespaced: true,
  state: {
    arrivalCar: {}, //到店车辆信息
    carLists: [], //车辆列表
    userName: '', //用户姓名
    userMobile: '', //用户电话
    userId: '', //用户id
    userImg: '', //用户头像
    serveTypes: [], //可选服务列表
    queueTypes: [], //可选排队列表

    // 新建订单的 - 已选的服务商品列表
    checkedServeList: [
      {
        goods_Name: '',
        service_Fee: '',
        added_Rate: '',
        sale_Price: '',
        amount: 1,
      },
    ],

    categoryGoodsData: {}, // 新建订单的选择分类 - 车品适配的数据
    carInfo: {}, //到店单的车辆信息
    arrvialId: '', // 到店单id
    arrvialPhone: '', //到店单的电话
    worker: '', //技师
    workerTime: '', //施工时间
    qualityState: 2, //质检报告状态 2 未提交 1 已提交
    orderService: '', //服务类型
    signData: {}, //签名页所需数据

    // 接口方法名
    fnNames: {
      getQrcode: 'getQrcode', // 获取二维码
      sendMsg: 'sendMsg', // 发送短信
    },

    // 已选检测异常列表项
    selectedErrList: [],

    groupList: [], //福利包券扫码订单商品、服务
    orderGoodsList: [], //订单商品列表
    orderServiceList: [], //订单服务列表
  },
  mutations: {
    //设置到店车辆
    setArrivalCar(state, data) {
      state.arrivalCar = data
    },

    //保存用户所有车辆
    setCarList(state, data) {
      state.carLists = data
    },

    //保存用户信息
    setUserInfo(state, data) {
      state.userName = data.name
      state.userMobile = data.mobile
      state.arrvialPhone = data.mobile
    },

    //保存用户信息
    setUserInfo2(state, data) {
      state.userId = data.userId
      state.userImg = data.userImg
    },

    //重置用户信息
    resetUser(state) {
      state.userName = ''
      state.userMobile = ''
      state.userId = ''
      state.userImg = ''
    },

    //保存服务和排队列表
    setServeAndQueue(state, data) {
      state.serveTypes = data.service
      state.queueTypes = data.queue
    },

    //重置到店车辆数据
    resetCar(state) {
      state.arrivalCar = {}
      state.carLists = []
    },

    // 新建订单 - 赋值已选服务商品列表
    setCheckedServeList(state, val) {
      state.checkedServeList = val
    },

    // 选择车品分类到分类详情列表
    setCategoryGoodsData(state, val) {
      state.categoryGoodsData = val
    },

    //到店单的车辆信息
    setCar(state, data) {
      state.carInfo = data
    },
    //到店id
    setArrvialId(state, data) {
      state.arrvialId = data.id
      state.arrvialPhone = data.phone
      state.worker = data.worker
      state.workerTime = data.workerTime
      state.qualityState = data.qualityState
      state.orderService = data.orderService
    },
    //签名页所需数据
    setSignData(state, data) {
      state.signData = data
    },

    // 客户确认，扫码，短信，签字确认
    setFnNames(state, data) {
      state.fnNames = data
    },

    // 选择关联订单的检测异常项
    setOrderErrList(state, data) {
      state.selectedErrList = data
    },

    //保存来自福利包的商品、服务
    setGroupList(state, data) {
      state.groupList = data
    },

    //保存订单中的商品和服务
    setOrderGoodsAndService(state, data) {
      state.orderGoodsList = data.productList
      state.orderServiceList = data.serveList
    },
  },
  actions: {},
}

export default afterSales
